# 导入prettytable
from prettytable import PrettyTable

# 定义表头
headers = ["学号", "姓名", "年龄", "性别"]
# 定义每行数据
rows = [
    ["001", "李磊", 16, "男"],
    ["002", "韩梅梅", 17, "女"],
    ["003", "Tom", 15, "男"],
]


# 创建一个表格对象
table = PrettyTable()

# 设置表头
table.field_names = headers

# 添加每行数据
table.add_row(rows[0])
table.add_row(rows[1])
table.add_row(rows[2])

# 打印表格
print(table)
